import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import ElementPlus from 'unplugin-element-plus/vite'
import path from "path"
export default defineConfig({
    css: {
        preprocessorOptions: {
            scss: {
                additionalData: `@use "/src/styles/element/index.scss" as *;`,
            },
        },
    },
    plugins: [
        vue(),
        // 自动引入子组件功能
        AutoImport({
            resolvers: [ElementPlusResolver()],
        }),
        Components({
            resolvers: [ElementPlusResolver({
                importStyle: "sass",
            })],

        }),
        ElementPlus({
            useSource: true,
        }),
    ],
    // 配置别名路劲
    resolve: {
        alias: {
            "@": path.resolve(__dirname, 'src')
        }
    }
})